<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>4、找出数组里最大的素数。</title>
</head>

<body>
  <script>
    let arr = [1, 3, 37, 97]
    for (let i = 1; i < arr.length; i++) {
      let age = 1
      for (let j = 2; j < i; j++) {
        if (arr[i] % arr[j] == 0) {
          age = 0
        }
      }
      max = arr[0]
      if (age) {
        if (arr[i] > max) {
          max = arr[i]
        }
      }

    }
    console.log(max)
  </script>
</body>

</html>